﻿//Main ViewModel  
//author: Alexis 2011-06-18
//blog: http://www.cnblogs.com/alexis/

using MvvmLight;
using MvvmLight.Command;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using MvvmLight.Messaging;
using System;
using Microsoft.Phone.Tasks;
using System.Linq;
using System.Windows;
using Microsoft.Phone.Shell;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.IO.IsolatedStorage;
using Microsoft.Phone;
using TechNewsReader.Model;
using TechNewsReader.Common;
using DataService;

namespace TechNewsReader.ViewModel
{
    public class MainViewModel : ViewModelBase
    {
        #region Property

        private int _selectedIndex;
        public int SelectedIndex
        {
            get
            {
                return _selectedIndex;
            }
            set
            {
                if (value==0)
                {
                    
                }
                else if(value==1)
                {

                }
                else if(value==2)
                {

                }
                _selectedIndex = value;
                RaisePropertyChanged(() => SelectedIndex);
            }
        }

        public ObservableCollection<HubTileItem> HubTiles { get; set; }

        private DownloadManager _downloadMgr;
        public DownloadManager DownloadMgr
        {
            get
            {
                if (_downloadMgr==null)
                {
                    _downloadMgr = new DownloadManager();
                }
                return _downloadMgr;
            }
        }

        public MainViewModel()
        {
            
            InitHubTiles();
        }

        #endregion

        #region Constructor


        #endregion

        #region Command

        #endregion

        #region method

        private void InitHubTiles()
        {
            HubTiles = new ObservableCollection<HubTileItem>
            {
                new HubTileItem {
                    ImageUri =ResourcesConstants.TileBaidu,
                    Title = "百度新闻", Notification = "$3.49", GroupTag = "TileGroup"},
                new HubTileItem {
                    ImageUri =ResourcesConstants.TileCnbeta,
                    Title = "Cnbeta", Notification = "Only $2.49", GroupTag = "TileGroup"},
                new HubTileItem {
                    ImageUri = ResourcesConstants.TileSina,
                    Title = "Chicken\nFillet",
                    Message = "A couple of these will not hurt your diet."},
                new HubTileItem {
                    ImageUri = ResourcesConstants.TileNet,
                    Title = "Burger", Notification = "$3.99"},
                new HubTileItem {
                    ImageUri = ResourcesConstants.TileSina,
                    Title = "Chicken\nBucket", Notification = "$19.99"},
                new HubTileItem {
                    ImageUri = ResourcesConstants.TileSina,
                    Title = "Fries", Notification = "Only $1.99"},
                new HubTileItem {
                    ImageUri = ResourcesConstants.TileSina,
                    Title = "Caesar Salad", Notification = "$4.99"
                },
                new HubTileItem {
                    ImageUri = ResourcesConstants.TileSina,
                    Title = "Corn", Notification = "Only $1.99"
                },
            };
        }

        #endregion


        
    }
}